*This file creates industry robustness tables D.1-D.6

use "$path/industry_data.dta", clear

*Define controls again
global linearcontrols c.lnlabor_all1943#year  c.power_labor_share1943#year c.ln_relative_wage1943#year c.ln_value_prod1943#year c.ln_establishments1943#year c.skilled1943#year c.ln_inputs_all1943#year c.ln_valueadded1943#year 

global highcontrols c.lnlabor_all1943#year  c.power_labor_share1943#year c.ln_relative_wage1943#year c.ln_establishments1943#year c.skilled1943#year c.ln_inputs_all1943#year 

*Generate year groups.

gen group0=(year>1933&year<1943)

gen group1=(year>1943&year<1953)
	
gen group2=(year>1952&year<1961)
	
gen group3=(year>1960&year<1971)

******************************************
*****Flexible estimates********
******************************************

preserve

gen lngroup0=	group0*ln_repa_tot
gen lngroup1=	group1*ln_repa_tot
gen lngroup2=	group2*ln_repa_tot
gen lngroup3=	group3*ln_repa_tot


label var lngroup0 "1934-1942 x ln(Reparations)"
label var lngroup1 "1944-1952 x ln(Reparations)"
label var lngroup2 "1953-1960 x ln(Reparations)"
label var lngroup3 "1961-1970 x ln(Reparations)"

global share treat_std_l

gen sharegroup0=	group0*$share
gen sharegroup1=	group1*$share
gen sharegroup2=	group2*$share
gen sharegroup3=	group3*$share

label var sharegroup0 "1934-1942 x Reparations Share"
label var sharegroup1 "1944-1952 x Reparations Share"
label var sharegroup2 "1953-1960 x Reparations Share"
label var sharegroup3 "1961-1970 x Reparations Share"

gen highgroup0=	group0*d2_s
gen highgroup1=	group1*d2_s
gen highgroup2=	group2*d2_s
gen highgroup3=	group3*d2_s

label var highgroup0 "1934-1942 x High Reparations"
label var highgroup1 "1944-1952 x High Reparations"
label var highgroup2 "1953-1960 x High Reparations"
label var highgroup3 "1961-1970 x High Reparations"

gen lowgroup0=	group0*d1_s
gen lowgroup1=	group1*d1_s
gen lowgroup2=	group2*d1_s
gen lowgroup3=	group3*d1_s

label var lowgroup0 "1934-1942 x Low Reparations"
label var lowgroup1 "1944-1952 x Low Reparations"
label var lowgroup2 "1953-1960 x Low Reparations"
label var lowgroup3 "1961-1970 x Low Reparations"

gen  high_post2=post*d2_s
gen  low_post2=	post*d1_s

label var high_post2 "Post x High Reparations"
label var low_post2 "Post x Low Reparations"

local repaflexible1 " lngroup0 lngroup1 lngroup2 lngroup3 "

foreach x in ln_value_prod lnlabor_all ln_valueadded{
reghdfe `x' `repaflexible1', absorb(year isic $linearcontrols) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe "\checkmark"
estadd local established "Yes"

estimates store l`x'1 
}

foreach x in ln_value_prod lnlabor_all  ln_valueadded{
reghdfe `x' `repaflexible1', absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe " "
estadd local c43 "\checkmark"
estadd local established "No"

estimates store l`x'2 
}

foreach x in ln_value_prod lnlabor_all  ln_valueadded{
reghdfe `x' `repaflexible1' if timberpaper==0, absorb(year isic $linearcontrols) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe "\checkmark"
estadd local established "No"

estimates store l`x'3 
}

local repaflexible1 " highgroup0 highgroup1 highgroup2 highgroup3  lowgroup0 lowgroup1 lowgroup2 lowgroup3"

foreach x in ln_value_prod lnlabor_all ln_valueadded{
reghdfe `x' `repaflexible1', absorb(year isic $highcontrols) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe "\checkmark"
estadd local established "Yes"
estimates store h`x'1 
}

foreach x in ln_value_prod lnlabor_all  ln_valueadded{
reghdfe `x' `repaflexible1', absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe " "
estadd local c43 "\checkmark"
estadd local established "No"
estimates store h`x'2 
}

foreach x in ln_value_prod lnlabor_all  ln_valueadded{
reghdfe `x' `repaflexible1' if timberpaper==0, absorb(year isic $highcontrols) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe "\checkmark"
estadd local established "No"
estimates store h`x'3 
}

*Post

foreach x in ln_value_prod lnlabor_all ln_valueadded{
reghdfe `x' high_post2 low_post2, absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe "\checkmark"
estadd local established "Yes"
estimates store h`x'4
}

foreach x in ln_value_prod lnlabor_all  ln_valueadded{
reghdfe `x' high_post2 low_post2 if timberpaper==0, absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estadd local ife "\checkmark"
estadd local yfe " "
estadd local c43 "\checkmark"
estadd local established "No"
estimates store h`x'5 
}

esttab  lln_value_prod1 lln_value_prod2 lln_value_prod3  hln_value_prod1 hln_value_prod2 hln_value_prod3  llnlabor_all1 llnlabor_all2 llnlabor_all3 hlnlabor_all1 hlnlabor_all2 hlnlabor_all3   lln_valueadded1 lln_valueadded2 lln_valueadded3  hln_valueadded1 hln_valueadded2 hln_valueadded3 using   "$tables/DD_flexible_estimates_robust.tex",  ///
mgroups("ln Value of Production" "ln Labor Force"  "ln Value Added" ,   pattern(1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	replace  keep(lngroup0 lngroup1 lngroup2 lngroup3 highgroup0 highgroup1 highgroup2 highgroup3 lowgroup0 lowgroup1 lowgroup2 lowgroup3) nonotes ///
	 b(%9.3f) se(%9.3f) stats(N yfe c43 established, fmt(0 3) layout(@ @ @) ///
		labels("N"  "Elastic Net controls" "1943 controls"  "Established" ///
			)) ///
	label star(* .1 ** .05 *** .01) nodepvars nomtitle 	
		
restore 
	
*Robust established interaction

preserve
keep if year==1943
egen repa_std_shock_t=std(repa_sharel*timberpaper)
egen repa_std_shock_nt=std(repa_sharel*nottimberpaper)
keep isic repa_std_shock_t repa_std_shock_nt
tempfile shocks
save `shocks'
restore

joinby isic using `shocks'

*Define exposure by established industry
gen repa_std_shock_t_post=repa_std_shock_t*post
gen repa_std_shock_nt_post=repa_std_shock_nt*post
gen ln_repa_tot_post_t=ln_repa_tot*timberpaper*post
gen ln_repa_tot_post_nt=ln_repa_tot*nottimberpaper*post

foreach var in ln_value_prod lnlabor_all ln_valueadded {

reghdfe `var'  ln_repa_tot_post_t ln_repa_tot_post_nt, absorb(year isic $linearcontrols) vce(cluster isic) 
estadd local ii "162"
estimates store l`var'_2
estadd local base "\checkmark"
}

foreach var in ln_value_prod lnlabor_all ln_valueadded {
reghdfe `var' repa_std_shock_t_post  repa_std_shock_nt_post  , absorb(year isic $sharecontrols) vce(cluster isic) resid
estadd local ii "162"
estimates store l`var'_1 
estadd local base "\checkmark"
}

label var repa_std_shock_t_post "Reparations Share x Post x Established"
label var repa_std_shock_nt_post "Reparations Share  x Post x Non-Established"
label var ln_repa_tot_post_t "ln(Reparations)  x Post x Established"
label var ln_repa_tot_post_nt "ln(Reparations) x Post Non-Established"

esttab  lln_value_prod_1 lln_value_prod_2     llnlabor_all_1 llnlabor_all_2       lln_valueadded_1 lln_valueadded_2  using   "$tables/Robust_timberpaper_test.tex",  ///
mgroups("ln Value of Production" "ln Labor Force"  "ln Value Added" ,   pattern(1 0  1 0  1 0 )  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	replace  keep(repa_std_shock_t_post  repa_std_shock_nt_post ln_repa_tot_post_t ln_repa_tot_post_nt) nonotes ///
	 b(%9.3f) se(%9.3f) stats(N ii , fmt(0 3) layout(@ @ @) ///
		labels("N"  "Industries"  ///
			)) ///
	label star(* .1 ** .05 *** .01) nodepvars nomtitle 	
		
*Define controls
global controls43 c.power_labor_share1943#year    ///
c.ln_value_prod1943#year  c.lnlabor_all1943#year c.ln_relative_wage1943#year c.ln_establishments1943#year c.skilled1943#year c.ln_inputs_all1943#year c.ln_valueadded1943#year 
 
global controls38 c.power_labor_share1938#year    ///
c.ln_value_prod1938#year  c.lnlabor_all1938#year c.ln_relative_wage1938#year c.ln_establishments1938#year c.skilled1938#year c.ln_inputs_all1938#year
 
global controls34 c.power_labor_share1934#year    ///
c.ln_value_prod1934#year  c.lnlabor_all1934#year c.ln_relative_wage1934#year c.ln_establishments1934#year c.skilled1934#year c.ln_inputs_all1934#year
 
global controls40 c.power_labor_share1940#year    ///
c.ln_value_prod1940#year  c.lnlabor_all1940#year c.ln_relative_wage1940#year c.ln_establishments1940#year c.skilled1940#year c.ln_inputs_all1940#year
 
global lagged_prod  c.ln_value_prod1934#year  c.ln_value_prod1935#year  c.ln_value_prod1936#year  c.ln_value_prod1937#year  c.ln_value_prod1938#year  c.ln_value_prod1939#year  c.ln_value_prod1940#year  c.ln_value_prod1941#year  c.ln_value_prod1942#year  c.ln_value_prod1943#year 
 
global lagged_labor c.lnlabor_all1934#year  c.lnlabor_all1935#year  c.lnlabor_all1936#year  c.lnlabor_all1937#year c.lnlabor_all1938#year c.lnlabor_all1939#year c.lnlabor_all1940#year c.lnlabor_all1941#year c.lnlabor_all1942#year c.lnlabor_all1943#year 
  
global lagged_va c.ln_valueadded1934#year c.ln_valueadded1935#year c.ln_valueadded1936#year c.ln_valueadded1937#year c.ln_valueadded1938#year c.ln_valueadded1939#year c.ln_valueadded1940#year c.ln_valueadded1941#year c.ln_valueadded1942#year c.ln_valueadded1943#year 

est clear
  
global share treat_std_l

gen sharegroup0=	group0*$share
gen sharegroup1=	group1*$share
gen sharegroup2=	group2*$share
gen sharegroup3=	group3*$share

label var sharegroup0 "1934-1942 x Reparations Share"
label var sharegroup1 "1944-1952 x Reparations Share"
label var sharegroup2 "1953-1960 x Reparations Share"
label var sharegroup3 "1961-1970 x Reparations Share"

label var scaledpost "Reparations share x Post"

foreach var in ln_value_prod lnlabor_all ln_valueadded {

reghdfe `var' scaledpost , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "162"
estimates store `var'1 
estadd local base "\checkmark"
estadd local cALL " "

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "162"
estimates store `var'2 
estadd local base "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estimates store `var'3 
estadd local c43 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estimates store `var'4
estadd local c43 "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls40 $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'5a 
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic  $controls40   $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'6a
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls40 $controls34  $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'5 
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic  $controls40 $controls34 $controls43  ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'6
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"
}

reghdfe ln_value_prod scaledpost , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_value_prod7 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_value_prod sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_value_prod8 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe lnlabor_all scaledpost, absorb(year isic $sharecontrols $lagged_labor ) vce(cluster isic) 
estadd local ii "162"
estimates store lnlabor_all7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reg lnlabor_all sharegroup0 sharegroup1 sharegroup2 sharegroup3 i.year $sharecontrols $lagged_labor , absorb(isic) vce(cluster isic) 
estadd local ii "162"
estimates store lnlabor_all8
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded scaledpost, absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_valueadded7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_valueadded8
estadd local base "\checkmark"
estadd local lagged "\checkmark"


esttab ln_value_prod1 ln_value_prod2 ln_value_prod3 ln_value_prod4 ln_value_prod5a ln_value_prod6a ln_value_prod5 ln_value_prod6 ln_value_prod7 ln_value_prod8     using "$tables/Industry_robust_1.tex", replace booktabs  mlabels(none) ///
	mgroups("ln Value of production"  , pattern(1 0 0 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}")  ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead(\begin{tabular}{l*{10}{c}} \toprule) ///
	postfoot(\midrule)

	esttab lnlabor_all1 lnlabor_all2 lnlabor_all3 lnlabor_all4 lnlabor_all5a lnlabor_all6a lnlabor_all5 lnlabor_all6 lnlabor_all7 lnlabor_all8  using "$tables/Industry_robust_1.tex", append booktabs  mlabels(none) ///
	mgroups("Panel B: ln Labor force"  , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}") ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead("") ///
	postfoot(\midrule)
	
	esttab ln_valueadded1 ln_valueadded2 ln_valueadded3 ln_valueadded4 ln_valueadded5a ln_valueadded6a ln_valueadded5 ln_valueadded6 ln_valueadded7 ln_valueadded8  using "$tables/Industry_robust_1.tex", append booktabs  mlabels(none) ///
	mgroups("Panel C: ln Value added"   , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f)stats(N ii  base c43 c40 c34 lagged , labels( "\textit{N}" "Industries" "Baseline" "Controls 1943"  "Controls 1940" "Controls 1934"  "Lagged outcomes 1934-1943" )  ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )   nodepvars nomtitle ///
	prehead("") ///
	postfoot(\bottomrule \end{tabular})
	
****
*Robustness without the established industries
***

est clear
preserve

global table Industry_robust_2
est clear
drop if timberpaper==1

foreach var in ln_value_prod lnlabor_all ln_valueadded {

reghdfe `var' scaledpost , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "142"
estimates store `var'1 
estadd local base "\checkmark"
estadd local cALL " "


reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "142"
estimates store `var'2 
estadd local base "\checkmark"


reghdfe `var' scaledpost , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "142"
estimates store `var'3 
estadd local c43 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "142"
estimates store `var'4
estadd local c43 "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls40 $controls43 ) vce(cluster isic) 
estadd local ii "142"
estimates store `var'5a 
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic  $controls40   $controls43 ) vce(cluster isic) 
estadd local ii "142"
estimates store `var'6a
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls40 $controls34  $controls43 ) vce(cluster isic) 
estadd local ii "142"
estimates store `var'5 
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic  $controls40 $controls34 $controls43  ) vce(cluster isic) 
estadd local ii "142"
estimates store `var'6
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"

}

reghdfe ln_value_prod scaledpost , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "142"
estimates store ln_value_prod7 
estadd local base "\checkmark"
estadd local lagged "\checkmark"


reghdfe ln_value_prod sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "142"
estimates store ln_value_prod8 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe lnlabor_all scaledpost, absorb(year isic $sharecontrols $lagged_labor ) vce(cluster isic) 
estadd local ii "142"
estimates store lnlabor_all7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reg lnlabor_all sharegroup0 sharegroup1 sharegroup2 sharegroup3 i.year $sharecontrols $lagged_labor , absorb( isic  ) vce(cluster isic) 
estadd local ii "142"
estimates store lnlabor_all8
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded scaledpost, absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "142"
estimates store ln_valueadded7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "142"
estimates store ln_valueadded8
estadd local base "\checkmark"
estadd local lagged "\checkmark"

esttab ln_value_prod1 ln_value_prod2 ln_value_prod3 ln_value_prod4 ln_value_prod5a ln_value_prod6a ln_value_prod5 ln_value_prod6 ln_value_prod7 ln_value_prod8     using "$tables/$table.tex", replace booktabs  mlabels(none) ///
	mgroups("ln Value of production"  , pattern(1 0 0 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}")  ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead(\begin{tabular}{l*{10}{c}} \toprule) ///
	postfoot(\midrule)

	esttab lnlabor_all1 lnlabor_all2 lnlabor_all3 lnlabor_all4 lnlabor_all5a lnlabor_all6a lnlabor_all5 lnlabor_all6 lnlabor_all7 lnlabor_all8  using "$tables/$table.tex", append booktabs  mlabels(none) ///
	mgroups("Panel B: ln Labor force"  , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}") ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead("") ///
	postfoot(\midrule)
	
	esttab ln_valueadded1 ln_valueadded2 ln_valueadded3 ln_valueadded4 ln_valueadded5a ln_valueadded6a ln_valueadded5 ln_valueadded6 ln_valueadded7 ln_valueadded8  using "$tables/$table.tex", append booktabs  mlabels(none) ///
	mgroups("Panel C: ln Value added"   , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f)stats(N ii  base c43 c40 c34 lagged , labels( "\textit{N}" "Industries" "Baseline" "Controls 1943"  "Controls 1940" "Controls 1934"  "Lagged outcomes 1934-1943" )  ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )   nodepvars nomtitle ///
	prehead("") ///
	postfoot(\bottomrule \end{tabular})
	
	restore

****
*Robustness without the established timber paper in treatment
***

est clear
preserve

global table Industry_robust_3
est clear

replace scaledpost=0 if timberpaper==1
replace sharegroup0=0 if timberpaper==1
replace sharegroup1=0 if timberpaper==1
replace sharegroup2=0 if timberpaper==1
replace sharegroup3=0 if timberpaper==1

foreach var in ln_value_prod lnlabor_all ln_valueadded {

reghdfe `var' scaledpost , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "162"
estimates store `var'1 
estadd local base "\checkmark"
estadd local cALL " "

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "162"
estimates store `var'2 
estadd local base "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estimates store `var'3 
estadd local c43 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estimates store `var'4
estadd local c43 "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls40 $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'5a 
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic  $controls40   $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'6a
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' scaledpost , absorb(year isic $controls40 $controls34  $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'5 
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"

reghdfe `var' sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic  $controls40 $controls34 $controls43  ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'6
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"

}

reghdfe ln_value_prod scaledpost , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_value_prod7 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_value_prod sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_value_prod8 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe lnlabor_all scaledpost, absorb(year isic $sharecontrols $lagged_labor ) vce(cluster isic) 
estadd local ii "162"
estimates store lnlabor_all7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reg lnlabor_all sharegroup0 sharegroup1 sharegroup2 sharegroup3 i.year $sharecontrols $lagged_labor , absorb( isic  ) vce(cluster isic) 
estadd local ii "162"
estimates store lnlabor_all8
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded scaledpost, absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_valueadded7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded sharegroup0 sharegroup1 sharegroup2 sharegroup3 , absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_valueadded8
estadd local base "\checkmark"
estadd local lagged "\checkmark"

esttab ln_value_prod1 ln_value_prod2 ln_value_prod3 ln_value_prod4 ln_value_prod5a ln_value_prod6a ln_value_prod5 ln_value_prod6 ln_value_prod7 ln_value_prod8     using "$tables/$table.tex", replace booktabs  mlabels(none) ///
	mgroups("ln Value of production"  , pattern(1 0 0 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}")  ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead(\begin{tabular}{l*{10}{c}} \toprule) ///
	postfoot(\midrule)

	esttab lnlabor_all1 lnlabor_all2 lnlabor_all3 lnlabor_all4 lnlabor_all5a lnlabor_all6a lnlabor_all5 lnlabor_all6 lnlabor_all7 lnlabor_all8  using "$tables/$table.tex", append booktabs  mlabels(none) ///
	mgroups("Panel B: ln Labor force"  , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}") ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead("") ///
	postfoot(\midrule)
	
	esttab ln_valueadded1 ln_valueadded2 ln_valueadded3 ln_valueadded4 ln_valueadded5a ln_valueadded6a ln_valueadded5 ln_valueadded6 ln_valueadded7 ln_valueadded8  using "$tables/$table.tex", append booktabs  mlabels(none) ///
	mgroups("Panel C: ln Value added"   , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f)stats(N ii  base c43 c40 c34 lagged , labels( "\textit{N}" "Industries" "Baseline" "Controls 1943"  "Controls 1940" "Controls 1934"  "Lagged outcomes 1934-1943" )  ///
	fmt(0 2)) keep( scaledpost sharegroup0 sharegroup1 sharegroup2 sharegroup3 )   nodepvars nomtitle ///
	prehead("") ///
	postfoot(\bottomrule \end{tabular})
	
	restore
		
****
*Robustness of the high skill group
****

*Import industry skill. See paper for details.
preserve
use "$path/ind_edu.dta", clear
tempfile education
gen low_edu=(high_edu!=1)
save `education' 
restore

*drop _merge
joinby digt2 using `education' , unmatched (master) 

preserve
keep if year==1943

*only for the treated
replace high_edu=0 if high_edu==.&repa_sharel==0
replace low_edu=0 if low_edu==.&repa_sharel==0

gen h_std=(repa_sharel*high_edu)
egen h_std2=std(repa_sharel*high_edu)

gen l_std=(repa_sharel*low_edu)
egen l_std2=std(repa_sharel*low_edu)

gen hs_linear=ln_repa_tot*high_edu
gen ls_linear=ln_repa_tot*low_edu

gen high_skill_treated=(h_std>0)
gen low_skill_treated=(l_std>0)

keep isic h_std h_std2 l_std l_std2 low_edu high_edu hs_linear ls_linear high_skill_treated low_skill_treated
tempfile education2
save `education2' 

restore

drop _merge
joinby isic using `education2' , unmatched (master) 

est clear
preserve

global table Industry_robust_4
est clear

drop sharegroup0 sharegroup1 sharegroup2 sharegroup3
gen sharegroup0=	group0*h_std2
gen sharegroup1=	group1*h_std2
gen sharegroup2=	group2*h_std2
gen sharegroup3=	group3*h_std2

label var sharegroup0 "1934-1942 x Reparations Share x HS"
label var sharegroup1 "1944-1952 x Reparations Share x HS"
label var sharegroup2 "1953-1960 x Reparations Share x HS"
label var sharegroup3 "1961-1970 x Reparations Share x HS"

gen sharegroup0a=	group0*l_std2
gen sharegroup1a=	group1*l_std2
gen sharegroup2a=	group2*l_std2
gen sharegroup3a=	group3*l_std2

gen high_skill_post=h_std2*post
gen low_skill_post=l_std2*post

global single high_skill_post low_skill_post

global flexbible sharegroup0 sharegroup1 sharegroup2 sharegroup3 sharegroup0a sharegroup1a sharegroup2a sharegroup3a 

foreach var in ln_value_prod lnlabor_all ln_valueadded {


reghdfe `var' $single , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "162"
estimates store `var'1 
estadd local base "\checkmark"
estadd local cALL " "

reghdfe `var' $flexbible , absorb(year isic $sharecontrols) vce(cluster isic) 
estadd local ii "162"
estimates store `var'2 
estadd local base "\checkmark"

reghdfe `var' $single  , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estimates store `var'3 
estadd local c43 "\checkmark"

reghdfe `var'  $flexbible , absorb(year isic $controls43) vce(cluster isic) 
estadd local ii "162"
estimates store `var'4
estadd local c43 "\checkmark"

reghdfe `var' $single  , absorb(year isic $controls40 $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'5a 
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var'  $flexbible , absorb(year isic  $controls40   $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'6a
estadd local c40 "\checkmark"
estadd local c43 "\checkmark"

reghdfe `var' $single  , absorb(year isic $controls40 $controls34  $controls43 ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'5 
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"

reghdfe `var'  $flexbible , absorb(year isic  $controls40 $controls34 $controls43  ) vce(cluster isic) 
estadd local ii "162"
estimates store `var'6
estadd local c43 "\checkmark"
estadd local c40 "\checkmark"
estadd local c34 "\checkmark"
}

global lagged_prod2   c.ln_value_prod1934#year  c.ln_value_prod1936#year  c.ln_value_prod1937#year  c.ln_value_prod1938#year  c.ln_value_prod1939#year  c.ln_value_prod1940#year  c.ln_value_prod1941#year  c.ln_value_prod1942#year 
 
global lagged_va2 c.ln_valueadded1934#year c.ln_valueadded1936#year c.ln_valueadded1937#year c.ln_valueadded1938#year c.ln_valueadded1939#year c.ln_valueadded1940#year c.ln_valueadded1941#year c.ln_valueadded1942#year 

reghdfe ln_value_prod $single  , absorb(year isic $sharecontrols $lagged_prod ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_value_prod7 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reg ln_value_prod $flexbible  i.year $sharecontrols $lagged_labor , absorb( isic  ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_value_prod8 
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe lnlabor_all $single , absorb(year isic $sharecontrols $lagged_labor ) vce(cluster isic) 
estadd local ii "162"
estimates store lnlabor_all7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reg lnlabor_all $flexbible  i.year $sharecontrols $lagged_labor , absorb( isic  ) vce(cluster isic) 
estimates store lnlabor_all8
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reghdfe ln_valueadded $single , absorb(year isic $sharecontrols $lagged_va ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_valueadded7
estadd local base "\checkmark"
estadd local lagged "\checkmark"

reg ln_valueadded $flexbible  i.year $sharecontrols $lagged_labor , absorb( isic ) vce(cluster isic) 
estadd local ii "162"
estimates store ln_valueadded8
estadd local base "\checkmark"
estadd local lagged "\checkmark"


esttab ln_value_prod1 ln_value_prod2 ln_value_prod3 ln_value_prod4 ln_value_prod5a ln_value_prod6a ln_value_prod5 ln_value_prod6 ln_value_prod7 ln_value_prod8     using "$tables/$table.tex", replace booktabs  mlabels(none) ///
	mgroups("ln Value of production"  , pattern(1 0 0 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}")  ///
	fmt(0 2)) keep( high_skill_post    sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead(\begin{tabular}{l*{10}{c}} \toprule) ///
	postfoot(\midrule)

	esttab lnlabor_all1 lnlabor_all2 lnlabor_all3 lnlabor_all4 lnlabor_all5a lnlabor_all6a lnlabor_all5 lnlabor_all6 lnlabor_all7 lnlabor_all8  using "$tables/$table.tex", append booktabs  mlabels(none) ///
	mgroups("Panel B: ln Labor force"  , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f) stats(N , labels("\textit{N}") ///
	fmt(0 2)) keep( high_skill_post  sharegroup0 sharegroup1 sharegroup2 sharegroup3 )  nodepvars nomtitle ///
	prehead("") ///
	postfoot(\midrule)
	
	esttab ln_valueadded1 ln_valueadded2 ln_valueadded3 ln_valueadded4 ln_valueadded5a ln_valueadded6a ln_valueadded5 ln_valueadded6 ln_valueadded7 ln_valueadded8  using "$tables/$table.tex", append booktabs  mlabels(none) ///
	mgroups("Panel C: ln Value added"   , pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) ) ///
	compress lines star(* .1 ** .05 *** .01) label ///
	b(%9.3f) se(%9.3f)stats(N ii  base c43 c40 c34 lagged , labels( "\textit{N}" "Industries" "Baseline" "Controls 1943"  "Controls 1940" "Controls 1934"  "Lagged outcomes 1934-1943" )  ///
	fmt(0 2)) keep( high_skill_post  sharegroup0 sharegroup1 sharegroup2 sharegroup3 )   nodepvars nomtitle ///
	prehead("") ///
	postfoot(\bottomrule \end{tabular})
	
restore
	
	

	
	
	